from greenlet import greenlet

def produce(number):
    for i in range(0, 8):
        print("producer: ", number)
        number = transfor_gr.switch(chr(ord(number) - 32))


def transfo(number):
    for i in range(0, 8):
        print("    transfor: ", number)
        number = consumer_gr.switch(number)


def consume(number):
    for i in range(0, 8):
        print("        consumer: ", number)
        number = producer_gr.switch(chr(ord(number) + 33))


producer_gr = greenlet(produce)
transfor_gr = greenlet(transfo)
consumer_gr = greenlet(consume)

producer_gr.switch('a')
